import request from '@/utils/request'
import {Toast } from 'vant';

// 报修需要的信息相关
export function api_repairArea() {
    return request({
        url: '/repair/area',
        method: 'get',
    })
}
export function api_repairAreaGroup() {
    return request({
        url: 'repair/area/group',
        method: 'get',
    })
}


export function api_repairContent(repairTypeId) {
    return request({
        url: '/repair/content/' + repairTypeId,
        method: 'get',
    })
}
export function api_repairType() {
    return request({
        url: '/repair/type',
        method: 'get',
    })
}

// 报修订单相关

export function api_repairCreate(data) {

    Toast.loading({
        mask: true,
        message: '',
        duration:0
    })

    return request({
        url: '/order/create',
        method: 'post',
        data
    })
}

export function api_orderList(data) {

    // Toast.loading({
    //     mask: true,
    //     message: '',
    //     duration:0
    // })

    return request({
        url: '/order/list',
        method: 'post',
        data
    })
}

export function api_orderDetail(orderId) {
    return request({
        url: '/order/detail/'+orderId,
        method: 'get',})
}

export function api_orderDispatch(data) {
    return request({
        url: '/order/dispatch',
        method: 'post',
        data
    })
}

export function api_orderDistribution(data) {
    return request({
        url: '/order/distribution',
        method: 'post',
        data
    })
}

export function api_orderMaster(data) {
    return request({
        url: '/order/master',
        method: 'post',
        data
    })
}
// 用户取消订单
export function api_orderCancel(data) {
    return request({
        url: '/order/user/cancel',
        method: 'post',
        data
    })
}

// 维修师傅取消订单
export function api_orderMasterCancel(data) {
    return request({
        url: '/order/master/cancel',
        method: 'post',
        data
    })
}


export function api_orderWait(data) {
    return request({
        url: '/order/wait',
        method: 'post',
        data
    })
}

// 确认维修完成
export function api_orderRepaired(data) {
    return request({
        url: '/order/repaired',
        method: 'post',
        data
    })
}

// 确认收款
export function api_orderConfirm(orderId) {
    return request({
        url: '/order/confirm/paid/'+orderId,
        method: 'get',
    })
}
// 修改订单金额
export function api_orderPriceChange(data) {
    return request({
        url: '/order/price/change',
        method: 'put',
        data
    })
}

// 订单评论接口
export function api_orderEvaluation(data) {
    return request({
        url: '/evaluation/order',
        method: 'post',
        data
    })
}

// 报修发票相关
export function api_invoiceList() {
    return request({
        url: '/invoice/order/list',
        method: 'get',
    })
}
// 提交开票信息
export function api_invoiceCreate(data) {
    return request({
        url: 'invoice/create',
        method: 'post',
        data
    })
}

